FROM ccapnljh.mirror.aliyuncs.com/library/php:7.2.4-fpm

ENV TZ Asia/Shanghai


RUN apt-get update -y

RUN apt-get install -y git zip unzip vim apt-utils libpng-dev zlib1g zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev

# gd
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd

# pdo mysqli 扩展
RUN docker-php-ext-install pdo_mysql && docker-php-ext-install mysqli

# Opcache 扩展
RUN docker-php-ext-configure opcache --enable-opcache && docker-php-ext-install opcache

# redis 扩展
RUN pecl install redis-4.1.1 \
    && docker-php-ext-enable redis 

# PHP config
ADD php.ini /usr/local/etc/php/php.ini
ADD php-fpm.conf /usr/local/etc/php-fpm.conf
ADD php-fpm.d/* /usr/local/etc/php-fpm.d/


# composer
ADD composer.phar /usr/local/bin/composer
RUN chmod 755 /usr/local/bin/composer
RUN composer config -g repo.packagist composer https://packagist.phpcomposer.com


RUN mkdir -p /data/htdocs/lmm /data/htdocs/www /log/php/
RUN touch /log/php/php_errors.log /log/php/www.log.slow /log/php/www.access.log
RUN chown -R www-data.www-data /data/htdocs/ /log/php

# PHP config
ADD php.ini /usr/local/etc/php/php.ini
ADD php-fpm.conf /usr/local/etc/php-fpm.conf
ADD php-fpm.d/* /usr/local/etc/php-fpm.d/


